var HallBoard = Board.extend({
    _ccsFileName: res.HallBoard_json,
    onEnterTransitionDidFinish: function () {
        Board.prototype.onEnterTransitionDidFinish.call(this);
        playMusic('bgMusic');
        this.scheduleUpdate();
        this._returnHallBoard();
        getVersion();
        hideLoading();
        network.send(MsgCode.ReqFangKa, {});
        this.changeBG(settingData.HALL_BG_Id || 0);
        // /**
        //  * 引导更新
        //  */
        // if (gameData.opt_conf_2.nativecheck_weak && gameData.opt_conf_2.nativecheck_weak.indexOf(window.nativeVersion) >= 0) {
        //     showMessageBox('亲爱的玩家朋友们，' + app.appName + '新版本已经发布，诚邀您下载体验。\n新版本更加稳定流畅。欢迎您下载安装~', function () {
        //         cc.sys.openURL(app.shareDownLoadUrl);
        //     });
        // }
        // /**
        //  * 强制更新
        //  */
        // if (gameData.opt_conf_2.nativecheck_force && gameData.opt_conf_2.nativecheck_force.indexOf(window.nativeVersion) >= 0) {
        //     showAlert('亲爱的玩家朋友们，您使用的版本已经太老旧，' + app.appName + '新版本已经发布，更加稳定流畅。欢迎您下载安装~', function () {
        //         cc.sys.openURL(app.shareDownLoadUrl);
        //         //闪退
        //         cc.director.end(); //for Android
        //         crash(); // for iOS
        //     });
        // }
    },
    onExit: function () {
        
        Board.prototype.onExit.call(this);
        this.unscheduleUpdate();
    },
    _initNetworkListeners: function () {
        Board.prototype._initNetworkListeners.call(this);
        this._networkListeners = {
            CreateRoom: '_onCreateRoom',
            JoinRoom: '_onJoinRoom',
            SubUpdate: '_subUpdate',
            GS_StatusChange: '_onStatusChange',
            GS_Login: '_onLogin',
            GS_UserJoin: '_onUserJoin',
            ReContent: '_reConnect',
            ClubOpt: '_onClubOpt',
            MatchOpt: '_onMatchOpt',
            GoldOpt: '_onGoldOpt',
            Certified: '_onCertified'
        };
    },
    /**
     * 初始化只调用一次
     * @public
     */
    initBoard: function () {
        var self = this;
        var btnsList = [
            ['_clickClub', 'btn_club'],
            ['_clickCreateRoom', 'btn_creater'],
            ['_clickCreateRoom_zipai', 'btn_creater_zipai'],
            ['_clickCreateRoom_majiang', 'btn_creater_majiang'],
            ['_clickMatchRoom', 'btn_match'],
            ['_clickJoinRoom', 'btn_join'],
            ['_clickYuleRoom', 'btn_yule'],

            ['_clickSetting', 'btn_setting'],
            ['_clickShare', 'btn_share'],
            ['_clickHistory', 'btn_history'],
            ['_clickActivity', 'btn_activity'],
            ['_clickYaoqing', 'btn_yaoqing'],
            ['_clickWanFa', 'btn_rule'],
            ['_clickBD', 'btn_binding'],
            ['_clickCertified', 'btn_realname'],
            ['_clickMessage', 'btn_message'],
            ['_clickKefu', 'btn_kefu'],
            ['_clickShop', 'btn_shop'],
            ['_clickZhaoMu', 'btn_zhaomu'],
            /**
             * 通用功能
             */
            ['_clickTicketShop', 'btn_ticket_shop'],
            ['_clickEmail', 'btn_email'],
            //追加
            ['_clickOther1', 'btn_other1'],
            ['_clickOther2', 'btn_other2'],
            ['_clickBD', 'btn_bangding'],
            ['_clickRenZheng', 'btn_shiming'],
        ];

        for (var i = 0; i < btnsList.length; i++) {
            (function (k) {
                var btnData = btnsList[k];
                var btnName = btnData[1];
                var clickKey = btnData[0];
                var btn = (self._nodeList['root.' + btnName]
                || self._nodeList['root.logo_down.' + btnName]
                || self._nodeList['root.btn_Node.' + btnName]);
                if (btn) {
                    TouchUtil.setOnclickListener(btn, function () {
                        if (clickKey && clickKey.length > 0) {
                            self._unitClickHanler(clickKey);
                        }
                    });
                }
            })(i)
        }

        /*
        var meizi = playSpine(res.sp_meizi_json, 'dating_nvhai_1', true);
        self._nodeList['root.bg.logo_renwu.AniPos'].addChild(meizi);
        TouchUtil.setOnclickListener(self._nodeList['root.bg.logo_renwu'], function () {
            TouchUtil.setClickDisable(self._nodeList['root.bg.logo_renwu'],true);
            meizi.setAnimation(0, 'dating_nvhai_2', false);
            meizi.setCompleteListener(function () {
                TouchUtil.setClickDisable(self._nodeList['root.bg.logo_renwu'],false);
                meizi.setAnimation(0, 'dating_nvhai_1', true);
            });
        });
        */


        var qinyouquan = playSpine(res.sp_dating_json, 'qinyouquan', true);
        this._nodeList['root.btn_Node.btn_club.AniPos'].addChild(qinyouquan);

        var paohuzi = playSpine(res.sp_dating_json, 'paohuzi', true);
        this._nodeList['root.btn_Node.btn_creater_zipai.AniPos'].addChild(paohuzi);

        var majiang = playSpine(res.sp_dating_json, 'majiang', true);
        this._nodeList['root.btn_Node.btn_creater_majiang.AniPos'].addChild(majiang);

        var other1 = playSpine(res.sp_dating_json, 'yulechang', true);
        this._nodeList['root.btn_Node.btn_other1.AniPos'].addChild(other1);

        var btn_creater = playSpine(res.sp_dating_json, 'paodekuai', true);
        this._nodeList['root.btn_Node.btn_creater.AniPos'].addChild(btn_creater);

        var btn_join = playSpine(res.sp_dating_json, 'jiarufangjian', true);
        this._nodeList['root.btn_Node.btn_join.AniPos'].addChild(btn_join);

        var btn_other2 = playSpine(res.sp_dating_json, 'gengduowanfa', true);
        this._nodeList['root.btn_Node.btn_other2.AniPos'].addChild(btn_other2);

        /*
        if (cc.sys.isNative) {
            for (var i = 1; i < 4; i++) {
                var lizi = cc.ParticleSystem.create(login.res['huaihua_huaban' + i + '_plist']);
                lizi.setPosition(cc.p(cc.winSize.width + 100, cc.winSize.height + 100));
                this.addChild(lizi);
            }
        }
         */
    },
    /**
     * 验证
     * @param data
     * @private
     */
    _onCertified: function (data) {
        var _data = data;
        if (_data.cmd == "VerificationCode") {  // 发送验证码成功
            if (_data.error_code == 0) {
                eventManager.dispatchEvent(EventKey.ScheYZM);
            } else {
                showAlert("您输入的手机号码有误，请重新输入")
            }
        } else if (_data.cmd == "BindMobile") {  //绑定成功
            if (_data.error_code == 0) {
                var str = "手机号绑定成功";
                if (_data.numof_cards_2 > 0) {
                    str = '手机号绑定成功，恭喜获得' + _data.numof_cards_2 + '张房卡';
                    network.send(3013);
                }
                gameData.BDIphone = _data.mobile;
                showAlert(str);
                eventManager.dispatchEvent(EventKey.Close);
                eventManager.dispatchEvent(EventKey.Refresh_PlayerInfo);

            } else {
                showAlert('您输入的验证码有误，请重新输入')
            }
        } else if (_data.cmd == "UnbindMobile") {
            if (_data.error_code == 0) {
                gameData.BDIphone = "";
                setTimeout(function () {
                    // cc.log("==解绑成功倒计时=");
                    showAlert('您输入的验证码有误，请重新输入')
                }, 200);
            } else {
                showAlert('解绑失败!')
            }
        } else {
            if (_data.success) {
                gameData.hasShiMing = true;
                showAlert('认证成功', function () {
                });
                eventManager.dispatchEvent(EventKey.Refresh_PlayerInfo);
            } else {
                showAlert('验证失败,请重试！')
            }
        }
    },
    setLiuGuang: function (btn) {
        var clippingNode = new cc.ClippingNode();
        clippingNode.attr({
            stencil: new cc.Sprite(btn.getTexture()),
            x: btn.getContentSize().width * 0.5,
            y: btn.getContentSize().height * 0.5
        });
        clippingNode.setAlphaThreshold(0.5);
        clippingNode.setInverted(false);
        clippingNode.setName('ClippingNode');
        btn.getParent().addChild(clippingNode, 1);

        var spark = new cc.Sprite(res.yingguang_png);
        clippingNode.addChild(spark);
        spark.runAction(cc.repeatForever(cc.sequence(
            cc.moveTo(1.8, cc.p(btn.getContentSize().width, 20)),
            cc.moveTo(0, cc.p(-btn.getContentSize().width, 20)),
            cc.delayTime(3)
        )));

        var spark2 = new cc.Sprite(res.rouguang_png);
        clippingNode.addChild(spark2);
        spark2.runAction(cc.repeatForever(cc.sequence(
            cc.moveTo(2, cc.p(-btn.getContentSize().width, 0)),
            cc.moveTo(0, cc.p(btn.getContentSize().width, 0)),
            cc.delayTime(3)
        )));
    },
    /**
     * 自动加入房间
     * @private
     */
    update: function (dt) {
        Board.prototype.update.call(this, dt);
        var returnId = MWUtil.getReturnId();
        if (!isNullString(returnId)) {
            MWUtil.clearReturnId();
            if (window.nativeVersion < '4.0.0') {
                returnId = parseInt(returnId);
                if (returnId != 0 && returnId.toString().length < 6) {
                    this._clickClub(returnId);
                } else if (returnId.toString().length == 6) {
                    showLoading('正在自动加入房间!');
                    network.send(MsgCode.JoinRoom, {room_id: returnId});
                }
            } else {
                this._dealMRetuen(returnId);
            }
        }
        if (XianLiaoUtil.getReturnId) {
            returnId = XianLiaoUtil.getReturnId();
            if (!isNullString(returnId)) {
                returnId = parseInt(returnId);
                XianLiaoUtil.clearReturnId();
                if (returnId != 0 && returnId.toString().length < 6) {
                    this._clickClub(returnId);
                } else if (returnId.toString().length == 6) {
                    showLoading('正在自动加入房间!');
                    network.send(MsgCode.JoinRoom, {room_id: returnId});
                }
            }
        }
    },

    /**
     * 从其他board返回到HallBoard时
     * @private
     */
    _returnHallBoard: function () {
        /**
         * 俱乐部数据
         */
        cc.log('gameData.roomClubId===' + gameData.roomClubId);
        if (gameData.roomClubId) {
            this._clickClub();
        }
        /**
         * 设置金币场数据
         */
        // jbc.setSgameBridge();
        /**
         * 金币场的断线续玩  
         */
        // if (gameData.jbcData) {
        //     if (gameData.jbcData.last && gameData.jbcData.last.game_type == 1) {
        //         this._clickJBC_DDZ();
        //     } else if (gameData.jbcData.last && gameData.jbcData.last.game_type == 2) {
        //         this._clickJBC_XL();
        //     } else if (gameData.jbcData.last && gameData.jbcData.last.game_type == 3) {
        //         this._clickMatch();
        //     } else if (gameData.jbcData.last && gameData.jbcData.last.game_type == 4) {
        //         this._clickJBC_PDK();
        //     } else if (gameData.jbcData.last && gameData.jbcData.last.game_type == 5) {
        //         this._clickMatch();
        //         this._loadPDKMatch();
        //     }
        // }
        /**
         * 金币场跑得快
        //  */
        // if (gameData.enterJBC) {
        //     gameData.enterJBC = false;
        //     this._clickJBC_PDK();
        // }
        // /**
        //  * 比赛场
        //  */
        // if (gameData.enterRoomWithMatchID || gameData.isLunKong) {
        //     gameData.enterRoomWithMatchID = false;
        //     this._clickMatch();
        // }
    },

    /**
     * 处理魔窗返回
     * @protected
     * */
    _dealMRetuen: function (returnId) {
        var self = this;
        var mmap = {};
        var data_parmas = returnId.split(',');
        for (var i = 0; i < data_parmas.length; i++) {
            var dataParma = data_parmas[i];
            var datakv = dataParma.split('=');
            if (datakv.length == 2) {
                mmap[datakv[0]] = datakv[1];
            }
        }
        //判断数据是否是俱乐部id数据
        if (_.isString(mmap.roomid) && mmap.roomid.length == 6) {
            if (mmap.roomid.startsWith('0')) {
                var clubId = parseInt(mmap.roomid);
                if (clubId) {
                    if (self && cc.sys.isObjectValid(self)) {
                        self._clickClub(clubId);
                    }
                }
                return;
            }
        }
        if (mmap.roomid) {
            showLoading('正在自动加入房间!');
            network.send(MsgCode.JoinRoom, {room_id: mmap.roomid});
            return;
        }
        if (mmap.clubid) {
            // todo
        }
    },

    /**
     * 状态改变
     * @param event
     * @private
     */
    _onStatusChange: function (data) {
        showToast(data.Status);
    },

    /**
     * 断线重连
     * @private
     */
    _reConnect: function (data) {
        SubUpdateUtil.showGameScene(data, ROOM_DATA_TYPE.RECONNECT);
    },

    /**
     * 验证登录
     * @param event
     * @private
     */
    _onLogin: function (event) {
        var data = event.getUserData();
        var Result = 0;
        if (data.Head) {
            Result = data.Head.Result;
        } else {
            Result = data.Result;
        }
        if (Result == 0) {
            mRoom.setRoomType(2);
            if (mRoom.roomType == 1) {
            } else if (mRoom.roomType == 2) {
                //加入房间要收到确切的加入房间消息才能加入,断线重连直接进入房间
                // var cmd = "JoinRoom/" + mRoom.roomId;//Continue
                // network.wsData(cmd, true);
                // network.stop();
                // if (gameData.wanfatype == mRoom.YOUXIAN) {
                //     HUD.showScene(HUD_LIST.Room, this);
                // }
            }
        } else if (Result == ERR_CODE.VERSION_ERR) {
            if (cc.sys.isNative) {
                // HUD.showMessageBox('提示', '系统检测到有新的游戏版本，为避免影响您的游戏体验，请尽快大退游戏进行更新。', function () {
                //     if (cc.sys.os == cc.sys.OS_ANDROID) {
                //         cc.director.end();
                //     }
                // }, true);

                showMessageBox('系统检测到有新的游戏版本，为避免影响您的游戏体验，请尽快大退游戏进行更新。', function () {
                    if (cc.sys.os == cc.sys.OS_ANDROID) {
                        cc.director.end();
                    }
                });
            }
        } else {
            showToast('登录失败');
        }
    },
    /**
     * 胡子加入房间
     * @param data
     * @private
     */
    _onUserJoin: function (data) {
        var Result = null;
        if (data.Head) {
            Result = data.Head.Result;
        }
        if (data.Result != null) {
            Result = data.Result;
        }
        if (Result == 0) {
            SubUpdateUtil.showGameScene(data, ROOM_DATA_TYPE.CREATE);
        } else {
            hideLoading();
            if (data.Head) {
                showMessageBox(data.Head.ErrorMsg);
            } else {
                showMessageBox(data.ErrorMsg);
            }
        }
    },

    _initEventListeners: function () {
        Board.prototype._initEventListeners.call(this);
        this._eventListeners[EventKey.HallBoardBtnEvent] = "_unitClickHanler";
        this._eventListeners[EventKey.HallBoardRoomBtnEvent] = "_createRoomBtnClickHanler";
        this._eventListeners[EventKey.HallBoardRoomBGEvent] = "changeBG";
        this._eventListeners[EventKey.ReceiveXianliaoShareGame] = "_xianLiaoJoinRoom";
    },
    changeBG:function (id) {
        this._nodeList['root.bg' ].setTexture(hall.res['hallbg'+id]);
    },
    /**
     * 创建房间
     * @param data  数据
     * @param errorCode  错误码
     * @private
     */
    _onCreateRoom: function (data, errorCode) {
        var that = this;
        if (errorCode) {
            var errorMsg = '创建房间失败, 请重试';
            if (errorCode == -40) errorMsg = '创建房间失败, 您的房卡不足';
            if (errorCode == -2) errorMsg = '版本过低。请退出后重新登陆';
            if (data && data.errorMsg) {
                errorMsg = data.errorMsg;
            }
            showAlert(errorMsg);
            hideLoading();
            return;
        }

        //俱乐部创建的
        if (data && data['club_id']) {
            network.send(3002, {
                room_id: '' + data.room_id
            });
            return;
        }
        hideLoading();
        if (data && data['is_daikai']) {
            that.mapId = data['map_id'] || 0;

            // showMessageBox(
            //     '代开房间创建成功，房间号：' + data['room_id'] + '，代扣房卡' + data['need_cards'] + '张',
            //     function () {
            //         that.addChild(new DaiKai(that.mapId));
            //     }
            // );
        }
    },

    /**
     * 加入房间
     * @param data
     * @param errorCode
     * @private
     */
    _onJoinRoom: function (data, errorCode) {
        if (errorCode) {
            var errorMsg = null;
            if (errorCode == -20) errorMsg = '房间号不存在, 请重新输入';
            if (errorCode == -30) errorMsg = '该房间已满员, 无法加入';
            if (errorCode == -60) errorMsg = '该房间已开始, 无法加入';
            if (errorCode == -40) errorMsg = '您的房卡不足';
            if (errorCode == -2) errorMsg = '版本过低。请退出后重新登陆';
            if (data && data.errorMsg) {
                errorMsg = data.errorMsg;
            }
            else if (errorCode == -1) {
                errorMsg = data.msg;
            }
            else if (data && data.msg) {
                errorMsg = data.msg;
            }
            hideLoading();
            if (errorCode == -93 || errorCode == -92) {
                gameData.players = data['players'];
                gameData.roomId = data['room_id'];
                gameData.distance = data['distance'] || 100;
                showWindow('PlayerInfoLocationWindow', true);
                return;
            }
            showAlert(errorMsg);
            return;
        }
        network.stop();
        this._initRoom(data, ROOM_DATA_TYPE.CREATE);
    },

    /**
     * 俱乐部操作监听
     * @param data
     * @private
     */
    _onClubOpt: function (data) {
        if (!data) {
            cc.error('俱乐部操作数据为空');
            return;
        }
        var cmd = data['command'];
        var errorCode = data['result'];
        var errorMsg = data['msg'];
        if (errorCode && errorMsg != '没有房间') {
            showAlert(errorMsg);
        }
        if (cmd == 'BroadcastUid') {
            this._clubBroadcastCommand(data);
        }
        data.scene = 'home';
        cc.eventManager.dispatchCustomEvent(cmd, data);
    },

    /**
     * 俱乐部广播操作
     * @private
     */
    _clubBroadcastCommand: function (data) {
        var message = data['data'];
        if (message) {
            var type = message['type'] || '';
            if (type == MessageType.Invite) {
                message.from_uid = data['from_uid'];
                message.club_id = data['club_id'];
                if (message['uids'].toString().indexOf(gameData.uid) >= 0) {
                    if (cc.sys.isObjectValid(this)) {
                        var clubNoticeLayer = this.getChildByName('clubNoticeLayer');
                        if (clubNoticeLayer) clubNoticeLayer.removeFromParent();
                        if (typeof ClubNoticeLayer != 'undefined') {
                            clubNoticeLayer = new ClubNoticeLayer(message, NoticeType.clubInvite);
                            clubNoticeLayer.setName('clubNoticeLayer');
                            cc.director.getRunningScene().addChild(clubNoticeLayer, ZORDER.DIALOG);
                        }
                    }
                }
            } else if (type == MessageType.Refused) {
                showAlert(message['msg']);
            }
        }
    },
    /**
     * 比赛场
     * @private
     */
    _clickMatch: function () {
        /*
        showWindow('javaClubWindow');
        return ;
        var sgLoder = new SGameDownloader();
        this.addChild(sgLoder);
        sgLoder.loadGame("jbclandlord", "res/project-jbc-landlord.manifest", "jbcddz", "match");
         */
    },
    _loadPDKMatch: function () {
        var sgLoder = new SGameDownloader();
        this.addChild(sgLoder);
        sgLoder.loadGame("jbcpdk", "res/project-jbc-pdk.manifest", "jbcpdk", "match");
    },
    _clickClub: function (joinId) {
        // showOldWindow('ClubMainLayer');
        // if (joinId) {
        //     showOldWindow('ClubInputLayer', 'join', joinId);
        // }
        //注释上方的不开启
        showBoard('ClubBoard', joinId);
    },
    /**
     * 大厅组件触摸后消息回调
     * @param type
     * @private
     */
    _unitClickHanler: function (type) {
        switch (type) {
            case '_clickClub':
                this._clickClub();
                break;
            case '_clickMatchRoom':
                this._clickMatch();
                break;
            case '_clickCreateRoom':
                //showWindow('HallCreateRoomWindow', 'hall');
                showAlert('敬请期待');
                break;
            case '_clickCreateRoom_zipai':
                // showWindow('WanFaWindow');
                showWindow('HallCreateRoomWindow', 'hall', undefined, undefined, undefined, undefined, '', 'tab_poke');
                break;
            case '_clickCreateRoom_majiang':
                // showWindow('WanFaWindow');
                showWindow('HallCreateRoomWindow', 'hall', undefined, undefined, undefined, undefined, '', 'tab_majiang');
                break;
            case '_clickJoinRoom':
                showWindow('JoinRoomWindow');
                break;
            case '_clickYuleRoom':
                break;
            case '_clickSetting':
                showWindow('SettingWindow_qylds', Setting_TYPE.Hall);
                break;
            case '_clickMessage':
                showWindow('NoticeWindow');
                break;
            case '_clickWanFa':
                showWindow('RulerWindow');
                break;
            case '_clickKefu':
                var userName = encodeURI(app.appName + "-" + gameData.uid + "-" + gameData.nickname);
                var indexURL = 'https://www.sobot.com/chat/pc/index.html?sysNum=8981263e62424b2cb62dae7b6402f56e&groupId=' + app.appGroupId + "&source=2&partnerId=" + app.area + "_" + gameData.uid + "&uname=" + userName;
                var url = "https://pay.yayayouxi.com/mochuang/page/index.html?title=";
                var url1 = url + encodeURI(app.appName) + "&link=" + app.shareMWID + "://asd&iframeSrc=" + indexURL;
                cc.sys.openURL(url1);
                break;
            case '_clickHistory':
                showWindow('RecordWindow');
                break;
            case '_clickTicketShop':
                showWindow('TicketShopWindow');
                break;
            case '_clickEmail':
                showWindow('EmailWindow');
                break;
            case '_clickShare':
                var title = app.appName;
                ShareUtil.ShareGame(title + '火爆上线，点击进行下载，日进斗金不是梦，盆满钵盈笑开怀！');
                break;
            case '_clickCertified':
                showWindow('CertifiedWindow');
                break;
            case '_clickZhaoMu':
                showWindow('YQHWindow');
                break;
            case '_clickBD':
                showWindow('BDIphoneWindow', true);
                break;
            case '_clickExit':
                showAlert('退出界面开发中...');
                break;
            case '_clickShop':
                showWindow('CoinShopWindow', CoinShopType.FangKa);
                break;
            case '_clickBD':
                showWindow('BDIphoneWindow', true);
                break;
            case '_clickRenZheng':
                showWindow('CertifiedWindow');
                break;
            case '_clickOther1':
                showAlert('敬请期待');
                break;
            case '_clickOther2':
                showAlert('敬请期待');
                break;
            default:
                cc.error(type + ' 消息没有处理者');
                break;
        }
    },
    /**
     * 金币斗地主
     * @private
     */
    _clickJBC_DDZ: function () {
        var that = this;
        var sgLoder = new SGameDownloader();
        that.addChild(sgLoder);
        sgLoder.loadGame("jbclandlord", "res/project-jbc-landlord.manifest", "jbcddz");
    },
    /**
     * 金币场血战血流
     * @private
     */
    _clickJBC_XL: function () {
        var sgLoder = new SGameDownloader();
        this.addChild(sgLoder);
        sgLoder.loadGame("mahjong", "res/project-jbc-mahjong.manifest", "mj");
    },
    /**
     * 金币跑得快
     * @private
     */
    _clickJBC_PDK: function () {
        var sgLoder = new SGameDownloader();
        this.addChild(sgLoder);
        sgLoder.loadGame("jbcpdk", "res/project-jbc-pdk.manifest", "jbcpdk");

    },
    /**
     * 网页游戏
     * @private
     */
    _clickWebGame: function (gameType) {
        webGame.openGameWebView(gameType);
    },
    /**
     * 大厅界面点击创建房间按钮回调
     * @param obj
     * @private
     */
    _createRoomBtnClickHanler: function (obj) {
        var sub = '';
        switch (obj.click) {
            case '_clickSub_Hz':
                sub = sub = app.sub_module.ZIPAI;
                break;
            case '_clickSub_Mj':
                sub = sub = app.sub_module.MaJiang;
                break;
            case '_clickSub_Pdk':
                // showAlert("敬请期待");
                // return ;
                sub = sub = app.sub_module.PDK;
                break;
            case '_clickSub_Erpizi':
                sub = 'epz';
                break;
            case '_clickSub_Fsp':
                sub = 'fsp';
                break;
            case '_clickSub_Changpai':
                sub = 'kaokao';
                break;
            case '_clickSub_doushisi':
                sub = 'dou14';
                break;
            case '_clickSub_ddz':
                sub = app.sub_module.JDDDZ;
                break;
            case '_clickSub_CheXuan':
                sub = 'chexuan';
                break;
            case '_clickSub_jbc_ddz':
                this._clickJBC_DDZ();
                return;
            case '_clickSub_jbc_xl':
                this._clickJBC_XL();
                return;
            case '_clickSub_jbc_pdk':
                this._clickJBC_PDK();
                return;
            case '_clickSub_bs_ddz':
                this._clickMatch();
                return;
            case '_clickSub_web_meiren':
                this._clickWebGame(webGame.gameType.jsmr);
                return;
            case '_clickSub_web_longcheng':
                this._clickWebGame(webGame.gameType.lcby);
                return;
            case '_clickSub_web_shiguang':
                this._clickWebGame(webGame.gameType.sghj);
                return;
            case '_clickSub_web_rxby':
                this._clickWebGame(webGame.gameType.rxby);
                return;
            case '_clickMoreJB':
                return;
            default:
                cc.error(type + ' 点击的创建房间没有对应的玩法mapID');
                break;
        }

        if (obj.clubId) {
            var clubId = obj.clubId;
            var isSetWanfa = obj.isSetWanfa;
            var currentWnafaIdex = obj.currentWnafaIdex;
            var isDaiKai = obj.isDaiKai ? obj.isDaiKai : false;
            SubUpdateUtil.showCreateRoom(sub, isDaiKai, clubId, isSetWanfa, currentWnafaIdex);
        } else {
            showWindow('HallCreateRoomWindow', 'hall');
            // SubUpdateUtil.showCreateRoom(sub);
        }
    },

    _xianLiaoJoinRoom: function (data) {
        var roomId = data.roomToken.split(',')[0];
        var str = 'roomid=' + roomId;
        this._dealMRetuen(str);
    },

    /**
     * 进入房间
     * @param data
     * @param roomDataType 是否是重连或回放
     * @private
     */
    _initRoom: function (data, roomDataType) {
        SubUpdateUtil.showGameScene(data, roomDataType);
    },
    /**
     * 模块更新
     * @private
     */
    _subUpdate: function (data) {
        SubUpdateUtil.subUpdate(data);
    },
    /**
     * 比赛场协议监听
     */
    _onMatchOpt: function (data) {
        if (data && data['cmd']) {
            cc.eventManager.dispatchCustomEvent('match_' + data['cmd'], data);
        }
    },
    /**
     * 金币场协议监听
     */
    _onGoldOpt: function (data) {
        if (data && data['cmd']) {
            cc.eventManager.dispatchCustomEvent('jbc_' + data['cmd'], data);
        }
    },
});